package com.bnz.service.impl;

import com.bnz.mapper.UserMapper;
import com.bnz.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class UserServiceImpl implements UserService {

	@Autowired
	private UserMapper userMapper;
	/**
	 * 1. 转账方法
	 * @param outNo     转出的账号
	 * @param inNo      转入的账号
	 * @param money     转账的金额
	 */
	@Override
	public void tranfer(int outNo, int inNo, double money) {
		//转出账户
		userMapper.update(outNo,money);
		int i = 10 / 0;
		//转入账户
		userMapper.update(inNo,-money);
	}
}
